/**
 * 文件描述如下：
 * 1. 设备驱动页面的数据
 */

// 处理交通流量页面的数据
const data_1 = {
  title: 'streammux',
  key: 'streammux',
  data: [
    {
      id: 0,
      key: 'batch-size',
      parentNode: 'streammux',
      name: 'batch-size',
      showType: 'input',
      inputType: 'int',
    },
    {
      id: 1,
      key: 'batched-push-timeout',
      parentNode: 'streammux',
      name: 'batched-push-timeout',
      showType: 'input',
      inputType: 'int',
    },
    {
      id: 2,
      key: 'buffer-pool-size',
      parentNode: 'streammux',
      name: 'buffer-pool-size',
      showType: 'input',
      inputType: 'int',
    },

    {
      id: 3,
      key: 'width',
      parentNode: 'streammux',
      name: '检测图片宽',
      showType: 'input',
      inputType: 'int',
    },
    {
      id: 4,
      key: 'height',
      parentNode: 'streammux',
      name: '检测图片高',
      showType: 'input',
      inputType: 'int',
    },
  ],
}

const data_2 = {
  title: 'pipeline 配置文件',
  key: 'source-list',
  data: [
    {
      id: 0,
      key: 'list',
      parentNode: 'source-list',
      name: '配置列表',
      showType: ['input', 'input'],
      inputType: 'text',
    },
  ],
}

const data_3 = {
  title: 'primary-gie',
  key: 'primary-gie',
  data: [
    {
      id: 0,
      key: 'plugin-type',
      parentNode: 'primary-gie',
      name: '插件类型',
      showType: 'input',
      inputType: 'int',
    },
    {
      id: 1,
      key: 'config-file-path',
      parentNode: 'primary-gie',
      name: '插件路径 ',
      showType: 'input',
      inputType: 'text',
    },
  ],
}

export const dataProcessing_deep_pop = (params) => {
  if (!params) return
  // 头部的块
  data_1.data.forEach((item) => {
    item.value = params[item.parentNode][item.key]
  })

  data_2.data.forEach((item) => {
    item.arr = params[item.parentNode][item.key]
  })

  data_3.data.forEach((item) => {
    item.value = params[item.parentNode][item.key]
  })

  return { data_1, data_2, data_3 }
}
